\section{loader.c File Reference}
\label{loader_8c}\index{loader.c@{loader.c}}
{\ttfamily \#include $<$stdio.h$>$}\par
{\ttfamily \#include $<$stdint.h$>$}\par
{\ttfamily \#include $<$stdlib.h$>$}\par
{\ttfamily \#include $<$unistd.h$>$}\par
{\ttfamily \#include $<$string.h$>$}\par
{\ttfamily \#include $<$dirent.h$>$}\par
{\ttfamily \#include $<$libgen.h$>$}\par
{\ttfamily \#include $<$signal.h$>$}\par
{\ttfamily \#include $<$fcntl.h$>$}\par
{\ttfamily \#include $<$assert.h$>$}\par
{\ttfamily \#include $<$stdbool.h$>$}\par
{\ttfamily \#include $<$ctype.h$>$}\par
{\ttfamily \#include $<$pwd.h$>$}\par
{\ttfamily \#include $<$grp.h$>$}\par
{\ttfamily \#include $<$time.h$>$}\par
{\ttfamily \#include $<$locale.h$>$}\par
{\ttfamily \#include $<$langinfo.h$>$}\par
{\ttfamily \#include $<$sys/types.h$>$}\par
{\ttfamily \#include $<$sys/stat.h$>$}\par
{\ttfamily \#include $<$sys/wait.h$>$}\par
{\ttfamily \#include $<$sys/quota.h$>$}\par
{\ttfamily \#include $<$readline/readline.h$>$}\par
{\ttfamily \#include $<$readline/history.h$>$}\par
{\ttfamily \#include \char`\"{}API.c\char`\"{}}\par
{\ttfamily \#include \char`\"{}include\_\-comands.h\char`\"{}}\par
\subsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct {\bf COMMAND}
\end{DoxyCompactItemize}
\subsection*{Defines}
\begin{DoxyCompactItemize}
\item 
\#define {\bf MAX\_\-ARGS}~20
\item 
\#define {\bf MAX\_\-COMS}~20
\item 
\#define {\bf ARGS\_\-DELIMITER}~\char`\"{} \char`\"{}
\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
int {\bf com\_\-help} ()
\item 
int {\bf com\_\-printenv} (int, char $\ast$$\ast$)
\item 
int {\bf com\_\-cp} (int, char $\ast$$\ast$)
\item 
int {\bf com\_\-ls} (int, char $\ast$$\ast$)
\item 
int {\bf com\_\-dir} (int, char $\ast$$\ast$)
\item 
int {\bf com\_\-cd} (int, char $\ast$$\ast$)
\item 
int {\bf com\_\-rm} (int, char $\ast$$\ast$)
\item 
void {\bf signal\_\-handler} (int)
\item 
int {\bf com\_\-exe} (char $\ast$)
\item 
int {\bf main} (int argc, char $\ast$$\ast$argv)
\item 
int {\bf com\_\-help} (int argc, char $\ast$$\ast$argv)
\item 
{\bf COMMAND} $\ast$ {\bf com\_\-find} (char $\ast$name)
\item 
int {\bf com\_\-dummy} (int argc, char $\ast$$\ast$argv)
\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
int {\bf argcount}
\item 
char $\ast$$\ast$ {\bf argvector}
\item 
int {\bf last\_\-executed\_\-command\_\-code}
\item 
{\bf COMMAND} {\bf cmd} [$\,$]
\end{DoxyCompactItemize}


\subsection{Define Documentation}
\index{loader.c@{loader.c}!ARGS\_\-DELIMITER@{ARGS\_\-DELIMITER}}
\index{ARGS\_\-DELIMITER@{ARGS\_\-DELIMITER}!loader.c@{loader.c}}
\subsubsection[{ARGS\_\-DELIMITER}]{\setlength{\rightskip}{0pt plus 5cm}\#define ARGS\_\-DELIMITER~\char`\"{} \char`\"{}}\label{loader_8c_a1e443b337adbf56ac43ce50e0fc57508}


Definition at line 37 of file loader.c.

\index{loader.c@{loader.c}!MAX\_\-ARGS@{MAX\_\-ARGS}}
\index{MAX\_\-ARGS@{MAX\_\-ARGS}!loader.c@{loader.c}}
\subsubsection[{MAX\_\-ARGS}]{\setlength{\rightskip}{0pt plus 5cm}\#define MAX\_\-ARGS~20}\label{loader_8c_a29b7451465deac204c5f7cb1f9c6e1fc}


Definition at line 35 of file loader.c.

\index{loader.c@{loader.c}!MAX\_\-COMS@{MAX\_\-COMS}}
\index{MAX\_\-COMS@{MAX\_\-COMS}!loader.c@{loader.c}}
\subsubsection[{MAX\_\-COMS}]{\setlength{\rightskip}{0pt plus 5cm}\#define MAX\_\-COMS~20}\label{loader_8c_a4ba6c04f9aa1a6cff7d6ecd3193eaae8}


Definition at line 36 of file loader.c.



\subsection{Function Documentation}
\index{loader.c@{loader.c}!com\_\-cd@{com\_\-cd}}
\index{com\_\-cd@{com\_\-cd}!loader.c@{loader.c}}
\subsubsection[{com\_\-cd}]{\setlength{\rightskip}{0pt plus 5cm}int com\_\-cd (int, \/  char $\ast$$\ast$)}\label{loader_8c_a6deccfc39585708f5258d7297539b28f}
\index{loader.c@{loader.c}!com\_\-cp@{com\_\-cp}}
\index{com\_\-cp@{com\_\-cp}!loader.c@{loader.c}}
\subsubsection[{com\_\-cp}]{\setlength{\rightskip}{0pt plus 5cm}int com\_\-cp (int, \/  char $\ast$$\ast$)}\label{loader_8c_ae56c0c3df03d45cb3db40a3cdaf954bf}
\index{loader.c@{loader.c}!com\_\-dir@{com\_\-dir}}
\index{com\_\-dir@{com\_\-dir}!loader.c@{loader.c}}
\subsubsection[{com\_\-dir}]{\setlength{\rightskip}{0pt plus 5cm}int com\_\-dir (int, \/  char $\ast$$\ast$)}\label{loader_8c_af91a105159b0534411621d548c8ad186}
\index{loader.c@{loader.c}!com\_\-dummy@{com\_\-dummy}}
\index{com\_\-dummy@{com\_\-dummy}!loader.c@{loader.c}}
\subsubsection[{com\_\-dummy}]{\setlength{\rightskip}{0pt plus 5cm}int com\_\-dummy (int {\em argc}, \/  char $\ast$$\ast$ {\em argv})}\label{loader_8c_acc8436c51a5376909a17f70ced234f86}


Definition at line 199 of file loader.c.

\index{loader.c@{loader.c}!com\_\-exe@{com\_\-exe}}
\index{com\_\-exe@{com\_\-exe}!loader.c@{loader.c}}
\subsubsection[{com\_\-exe}]{\setlength{\rightskip}{0pt plus 5cm}int com\_\-exe (char $\ast$ {\em cmdline})}\label{loader_8c_a52428f113965904df2b539f9e44accc7}


printf(\char`\"{}$\backslash$n\%s$\backslash$n\char`\"{}, cmdline); 



Definition at line 215 of file loader.c.

\index{loader.c@{loader.c}!com\_\-find@{com\_\-find}}
\index{com\_\-find@{com\_\-find}!loader.c@{loader.c}}
\subsubsection[{com\_\-find}]{\setlength{\rightskip}{0pt plus 5cm}{\bf COMMAND}$\ast$ com\_\-find (char $\ast$ {\em name})}\label{loader_8c_a1556e158026f1bc896d2ac8562f17a46}


Definition at line 188 of file loader.c.

\index{loader.c@{loader.c}!com\_\-help@{com\_\-help}}
\index{com\_\-help@{com\_\-help}!loader.c@{loader.c}}
\subsubsection[{com\_\-help}]{\setlength{\rightskip}{0pt plus 5cm}int com\_\-help (int {\em argc}, \/  char $\ast$$\ast$ {\em argv})}\label{loader_8c_a89e66db614c7e1e44efab980c0967bec}


Definition at line 175 of file loader.c.

\index{loader.c@{loader.c}!com\_\-help@{com\_\-help}}
\index{com\_\-help@{com\_\-help}!loader.c@{loader.c}}
\subsubsection[{com\_\-help}]{\setlength{\rightskip}{0pt plus 5cm}int com\_\-help ()}\label{loader_8c_add232c49d70c7dfb7b1c5edbf8f51e77}
\index{loader.c@{loader.c}!com\_\-ls@{com\_\-ls}}
\index{com\_\-ls@{com\_\-ls}!loader.c@{loader.c}}
\subsubsection[{com\_\-ls}]{\setlength{\rightskip}{0pt plus 5cm}int com\_\-ls (int, \/  char $\ast$$\ast$)}\label{loader_8c_aeb855dbeadb97524f3527a7cce6b2f2d}
\index{loader.c@{loader.c}!com\_\-printenv@{com\_\-printenv}}
\index{com\_\-printenv@{com\_\-printenv}!loader.c@{loader.c}}
\subsubsection[{com\_\-printenv}]{\setlength{\rightskip}{0pt plus 5cm}int com\_\-printenv (int, \/  char $\ast$$\ast$)}\label{loader_8c_a15bfa7b867cca71cdfdcfd908cfd09de}
\index{loader.c@{loader.c}!com\_\-rm@{com\_\-rm}}
\index{com\_\-rm@{com\_\-rm}!loader.c@{loader.c}}
\subsubsection[{com\_\-rm}]{\setlength{\rightskip}{0pt plus 5cm}int com\_\-rm (int, \/  char $\ast$$\ast$)}\label{loader_8c_a2dbd9935df68a2a03fa57f52da8ab458}
\index{loader.c@{loader.c}!main@{main}}
\index{main@{main}!loader.c@{loader.c}}
\subsubsection[{main}]{\setlength{\rightskip}{0pt plus 5cm}int main (int {\em argc}, \/  char $\ast$$\ast$ {\em argv})}\label{loader_8c_a3c04138a5bfe5d72780bb7e82a18e627}


Scraps from redirection tests; TODO: Redirection; char $\ast$red\_\-com = NULL; red\_\-com = malloc(sizeof(char $\ast$)); char red\_\-type = NULL;

if((red\_\-com = strstr(op\_\-coms[0], \char`\"{}$>$\char`\"{})) != NULL) \{ int fd; red\_\-type = $\ast$red\_\-com++; fd = open($\ast$red\_\-com, O\_\-CREAT); close(1); dup(fd); close(fd); \}



Definition at line 77 of file loader.c.

\index{loader.c@{loader.c}!signal\_\-handler@{signal\_\-handler}}
\index{signal\_\-handler@{signal\_\-handler}!loader.c@{loader.c}}
\subsubsection[{signal\_\-handler}]{\setlength{\rightskip}{0pt plus 5cm}void signal\_\-handler (int {\em sig})}\label{loader_8c_a8804db44b6d4c5752e6de5593562df06}


Definition at line 258 of file loader.c.



\subsection{Variable Documentation}
\index{loader.c@{loader.c}!argcount@{argcount}}
\index{argcount@{argcount}!loader.c@{loader.c}}
\subsubsection[{argcount}]{\setlength{\rightskip}{0pt plus 5cm}int {\bf argcount}}\label{loader_8c_aa9b31412bfe39a83843926c486082edf}


Definition at line 54 of file loader.c.

\index{loader.c@{loader.c}!argvector@{argvector}}
\index{argvector@{argvector}!loader.c@{loader.c}}
\subsubsection[{argvector}]{\setlength{\rightskip}{0pt plus 5cm}char$\ast$$\ast$ {\bf argvector}}\label{loader_8c_a48e7690ee5846e40a87963df06a87572}


Definition at line 55 of file loader.c.

\index{loader.c@{loader.c}!cmd@{cmd}}
\index{cmd@{cmd}!loader.c@{loader.c}}
\subsubsection[{cmd}]{\setlength{\rightskip}{0pt plus 5cm}{\bf COMMAND} {\bf cmd}[$\,$]}\label{loader_8c_a305cdb24369c8c8473fec1e23b995efb}
{\bfseries Initial value:}
\begin{DoxyCode}
 {
                {"?", com_help, "Display the help."},
                {"printenv", com_printenv, "Print enviroment variables."},
                {"ls", com_ls, "List information about the FILE."},
                {"cp", com_cp, "Copies SOURCE to DESTINATION."},
                {"dir", com_dir, "List information about the FILE."},
                {"cd", com_cd, "Change the current directory."},
                {"rm", com_rm, "Remove (unlink) the FILE."},
                { (char *)NULL, (Function *)NULL, (char *)NULL }
                }
\end{DoxyCode}


Definition at line 66 of file loader.c.

\index{loader.c@{loader.c}!last\_\-executed\_\-command\_\-code@{last\_\-executed\_\-command\_\-code}}
\index{last\_\-executed\_\-command\_\-code@{last\_\-executed\_\-command\_\-code}!loader.c@{loader.c}}
\subsubsection[{last\_\-executed\_\-command\_\-code}]{\setlength{\rightskip}{0pt plus 5cm}int {\bf last\_\-executed\_\-command\_\-code}}\label{loader_8c_a6645f1aded5094e7767b3006bc16ad7e}


Definition at line 56 of file loader.c.

